import React, { Component } from 'react';
import BaseComponent from '@/components/BaseComponent';
import { defDrawerWidth } from '@/defaultSettings';
import { Descriptions, Drawer, Tabs } from 'antd';
import styles from './index.less';
import ProductionwasteList from '../..//productionwaste/list';

const { TabPane } = Tabs;

class PreviewView extends BaseComponent {
  constructor(props) {
    super(props);
    this.state = {
      activeKey: '1',
    };
  }

  render() {
    const { onClose, visible = false, record } = this.props;
    return (
      <Drawer
        title="预览"
        placement="right"
        width={defDrawerWidth}
        closable={true}
        onClose={e => {
          if (onClose) {
            onClose(e);
          }
        }}
        visible={visible}
      >
        <Descriptions bordered column={2}>
          <Descriptions.Item label="仓库名称">{record.warehouse_name}</Descriptions.Item>
          <Descriptions.Item label="仓库类型">{record.warehouse_type_name}</Descriptions.Item>
          <Descriptions.Item label="仓库大小">{record.warehouse_size}</Descriptions.Item>
          <Descriptions.Item label="仓库储存能力">{record.warehouse_volume}</Descriptions.Item>
          <Descriptions.Item label="负责人">{record.principal}</Descriptions.Item>
          <Descriptions.Item label="电话">{record.contact}</Descriptions.Item>
          <Descriptions.Item label="仓库地址">{record.warehouse_address}</Descriptions.Item>
          <Descriptions.Item label="备注">{record.remarks}</Descriptions.Item>
        </Descriptions>
        {/*<Tabs activeKey={this.state.activeKey} onChange={this.handleTabOnChange}>
          <TabPane tab="基础信息" key="1"></TabPane>
          <TabPane tab="产废信息" key="2"></TabPane>
        </Tabs>
        {this.state.activeKey == '1' ? (
          <Descriptions bordered column={2}>
            <Descriptions.Item label="仓库名称">{record.warehouse_name}</Descriptions.Item>
            <Descriptions.Item label="仓库类型">{record.warehouse_type_name}</Descriptions.Item>
            <Descriptions.Item label="仓库大小">{record.warehouse_size}</Descriptions.Item>
            <Descriptions.Item label="仓库储存能力">{record.warehouse_volume}</Descriptions.Item>
            <Descriptions.Item label="负责人">{record.principal}</Descriptions.Item>
            <Descriptions.Item label="电话">{record.contact}</Descriptions.Item>
            <Descriptions.Item label="仓库地址">{record.warehouse_address}</Descriptions.Item>
            <Descriptions.Item label="备注">{record.remarks}</Descriptions.Item>
          </Descriptions>
        ) : null}
        {this.state.activeKey == '2' ? (
          <ProductionwasteList companyId={record['company_id']}></ProductionwasteList>
        ) : null}*/}
      </Drawer>
    );
  }

  // handleTabOnChange = key => {
  //   this.setState({
  //     activeKey: key,
  //   });
  // };
}

export default PreviewView;
